﻿using System.ComponentModel.DataAnnotations.Schema;
using System.Data.Entity.ModelConfiguration;

namespace InvestmentIntelligence.DbModel.Models.Mapping
{
    class TradedQuantityMap:EntityTypeConfiguration<TradedQuantity>
    {
        public TradedQuantityMap()
        {
            this.ToTable("TradedQuantity", "Analytics");

            this.HasKey(t => t.Id);
            this.HasRequired(t => t.Security);
            this.Property(t => t.Id).HasDatabaseGeneratedOption(DatabaseGeneratedOption.Identity);

            this.HasRequired(t => t.Investment)
                .WithMany(t => t.TradedQuantities)
                .HasForeignKey(d => d.InvestmentId);
        }
    }
}
